<template>
  <div>
    <h2>商品详情</h2>
    <!-- 商品详情 -->
    <img :src="goods.img">
    <p>商品名称：{{goods.name}}</p>
    <p>商品价格：{{goods.price}}</p>
    <p>颜色：<span v-for="(c,index) in goods.color" :key="index">{{c}}</span>&nbsp;</p>
    <hr/>
    <!-- 商品评论 -->
    <ul>
        <li v-for="item in comments" :key="item.id">
            <p>{{item.content}}</p>
            <p>评论人：{{item.username}}</p>
            <p>评论时间：{{item.time}}</p>
        </li>
    </ul>
  </div>
</template>

<script>
// import axios from "axios";

export default {
    name:"GoodsDetail",
    data(){
        return {
            goods:{},
            comments:[]
        }
    },
    created(){
        let proid = this.$route.params.goodsid

        
        this.$service.get("api/pro/detail/"+proid)
        .then(res=>{
            if(res.data.code==200){
                console.log("商品详情：",res.data.data);
            }
        })
    }
}
</script>

<style>

</style>